package com.twu.biblioteca;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by ecchilds on 3/10/14.
 */
public class Menu {
    private Out out;
    private UserIn userIn;
    private List<String> menuOptions;

    public Menu(Out out, UserIn userIn, ArrayList<String> menuOptions) {
        this.out = out;
        this.userIn = userIn;
        this.menuOptions = menuOptions;

    }

    public void displayMenu() {
        String header = "Main Menu:";
        out.printList(header, menuOptions);
    }

    public String getValidMenuOption() throws IOException {
        int validInput = userIn.getValidInputGivenRange("Menu", menuOptions.size());

        return menuOptions.get(validInput);
    }


}
